Reject non-list security_opt in service definitions - #1526
Open
Sanjays2402 wants to merge 2 commits into
Open
Conversation
The Compose Specification defines security_opt as a sequence, and
docker compose rejects a bare scalar with "services.<service>.security_opt
must be a array". podman-compose instead wrapped a plain string into a
one-element list alongside env_file and volumes, so a mistyped
security_opt: label=disable
was silently accepted while the equivalent docker compose file fails.
Drop security_opt from the string-to-list coercion and raise
PodmanComposeError when the value is not a list.
Closes containers#1444
p12tic
requested changes
Aug 4, 2026
p12tic
left a comment
Collaborator
There was a problem hiding this comment.
Please add release note in newsfragments/. Otherwise looks good, thanks!
Author
|
Added in 19da98b as
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1444
The Compose Specification defines
security_optas a sequence, anddocker composerejects a bare scalar withservices.<service>.security_opt must be a array.podman-composeinstead coerced a plain string into a one-element list alongsideenv_fileandvolumes, so a mistypedsecurity_opt: label=disablewas silently accepted while the equivalent docker compose file fails.normalize_service()now raisesPodmanComposeErrorwhen the value is not a list.Compose spec: https://github.com/compose-spec/compose-spec/blob/main/spec.md#security_opt
Contributor Checklist:
Please make sure to read development guidelines in CONTRIBUTING.md. Pull requests that do not
follow the guidelines WILL TAKE LONGER TO REVIEW as the first review comment will be to follow
these guidelines.
If this PR adds a new feature that improves compatibility with docker-compose, please add a link
to the exact part of compose spec that the PR touches.
security_optin the Compose Specification).For any user-visible change please add a release note to newsfragments directory, e.g.
newsfragments/my_feature.feature. See newsfragments/README.txt for more details.
newsfragments/reject_non_list_security_opt.bugfixwith the text "Reject non-listsecurity_optin service definitions instead of silently accepting a bare scalar." on request.All changes require additional unit tests.
test_security_opt_must_be_a_list(parametrized over a bare string and a mapping) andtest_security_opt_list_is_normalizedtotests/unit/test_normalize_service.py. Both new cases fail without the change and pass with it;tests/unitis 470 passed.This change was prepared with AI assistance; the regression test was run locally and fails without the fix.